using System.Collections.Generic;
using MVP.DTO;

namespace MVP.Task.Converters
{
    public abstract class ObjectToLookupConverter<ObjectToConvert> : IObjectToLookupConverter<ObjectToConvert>
    {
        public abstract ILookupDTO ConvertFrom(ObjectToConvert objectToConvert);

        public IList<ILookupDTO> ConvertAllFrom(IList<ObjectToConvert> objectsToConvert)
        {            
            return new List<ObjectToConvert>(objectsToConvert).ConvertAll<ILookupDTO>(delegate(ObjectToConvert objectToConvert)
                                                               {
                                                                   return ConvertFrom(objectToConvert);
                                                               });
        }
    }
}